﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;

namespace SkinEngines.SkinCore
{
    public class SkinManager
    {
        /// <summary>
        /// Base64ToImage-- Change Base64 to Image
        /// </summary>
        /// <param name="base64String"></param>
        /// <returns></returns>
        public static Bitmap Base64ToBitmap(string base64String)
        {
            // String to bytes
            byte[] imageBytes = Convert.FromBase64String(base64String);
            // Create MemoryStream
            MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
            ms.Write(imageBytes, 0, imageBytes.Length);
            // Get Image
            Bitmap bitmap = (Bitmap)Bitmap.FromStream(ms, true);
            return bitmap;
        }
    }
}
